<script setup>
import router from "@/router";
import NavBar from "../../Narbar/index.vue"
import { ref, reactive } from "vue"
import { loginOut } from "@/API/api";
const title = ref("设置")
const leftText = ref("")
const onClickRight = () => {
    // router.back()
}
const onClickLeft = () => {
    router.back()
}
const logiout = async () => {
    // let token=localStorage.getItem("access_token")
    // console.log(token,"166");
   
        let res = await loginOut()
        console.log(res);
        if(res.code==0){
            localStorage.clear()
            router.push("/")
        }
    
    // const token=localStorage.getItem("token")
    // if(token){
    //     localStorage.clear()
    //     router.reactive("/")
    // }

}
</script>

<template>
    <!-- ashf -->
    <NavBar :title="title" :leftText="leftText" :onClickRight="onClickRight" :onClickLeft="onClickLeft" />
    <button @click="logiout">退出登录</button>
</template>
<style lang="less" scoped></style>
